All Functions Used So Far, Week 3

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

ggplot

{GGPLOT2}

Create a ggplot graph

View

{base}

View a data frame

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

unique

{base}

get unique elements

get_mode

{rstatix}

Compute the mode in a given vector.

grid.arrange

{gridExtra}

Places graphical objects into a rectangular grid

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

rm

{base}

Remove objects

plot

{graphics}

Generic function from base R to produce a plot

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

c

{base}

Combine values/vectors into a vector

class

{base}

Retrieve class of an R object

geom_histogram

{GGPLOT2}

Generates a histogram

pie

{graphics}

Creates a basic pie chart

sum

{base}

Get sum of numeric values or a vector

mutate

{dplyr}

Modify/create a column in a data frame

install.packages

{base}

Install R package

runif

{stats}

Draws ranndom numbers from the uniform distribution

summary

{base}

Obtain summary statistics or detailed regression output

tabulate

{base}

Counts the number of times each integer occurs in an integer-only vector

labs

{GGPLOT2}

Customise labels in GGPLOT2

ifelse

{base}

Return a or b depending on the value of test

ungroup

{dplyr}

Resolve grouping created with “group_by”

matrix

{base}

Creates a matrix from the given set of values.

boxplot

{graphics}

Plot a simple box plot

ls.str

{utils}

Similarly to ls, with a print() method that calls str() on each object

desc

{dplyr}

Arrange in descending order

library

{base}

Load an R package

geom_bar

{GGPLOT2}

Generates a bar chart

head

{utils}

Show first 5 rows of a data frame

read.spss

{foreign}

Read a .sav file (SPSS data)

geom_density

{GGPLOT2}

Generates a density plot

lprop

{questionr}

Display row percentages of a two-way frequency table

hist

{graphics}

Plot a simple histogram

sd

{stats}

Get standard deviation of a vector

nrow

{base}

Get number of rows of a data frame

slice

{dplyr}

Subset rows using their positions

as.data.frame

{base}

Functions to check if an object is a data frame, or coerce it if possible.

recode

{dplyr}

Recode a variable

is.na

{base}

Check if a value is NA/elements of vector are NA

min

{base}

Get minimum of a vector

rbeta

{stats}

Beta Random Number Generating Function

select

{dplyr}

Select columns from a tibble/data frame

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

sample

{base}

Takes a sample of the specified size

filter

{dplyr}

Filter out rows of a data frame according to logical vector

after_stat

{GGPLOT2}

Control aesthetic evaluation. On the module used for displying percent

ordered

{dplyr}

Create an ordered factor

ylab

{GGPLOT2}

Label the y axis (ggplot)

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

rbind

{base}

Combine R objects by rows

ggtitle

{GGPLOT2}

Generates a title for a ggplot graph

which.max

{base}

return index of the largest value in a vector

ncol

{base}

Get number of columns of a data frame

cbind

{base}

Combine R objects by columns

seq

{base}

Create a sequence

names

{base}

Retrieve names of a list/vector

set.seed

{base}

Initialise a pseudorandom number generator.

theme_bw

{GGPLOT2}

A black and white ggplot theme

levels

{base}

Get levels of a factor

rnorm

{base}

Generate random numbers from a normal distribution

setwd

{base}

Set Working Directory

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

max

{base}

Get maximum of a vector

dim

{base}

Get dimensions of a data frame

xlab

{GGPLOT2}

Label the x axis (ggplot)

cut

{base}

Convert Numeric to Factor

median

{stats}

Get median of a vector

var

{stats}

Calculate variance

read_excel

{readxl}

Read an Excel file

order

{base}

Get indexes that will sort a vector

freq

{questionr}

Generate frequency tables

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

attach

{base}

Attach Set of R Objects to Search Path

str

{utils}

Get the structure of an R object

range

{base}

Return range of values

factor

{base}

Create a factor

mean

{base}

Get mean of a vector

round

{base}

Rounds numbers

The end!